<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8" %>
<!DOCTYPE HTML>
<html>

<head>
    <title>订单管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
    订单管理 <span class="c-gray en">&gt;</span>
    订单列表 </nav>
<div class="pd-20">
    <div class="text-c">

        <input type="text"  placeholder="编号" style="width:300px" class="input-text"id="uuid">&nbsp;&nbsp;&nbsp;
        <input type="text"  placeholder=" 客户姓名" style="width:120px" class="input-text"id="customer">&nbsp;&nbsp;&nbsp;
        <input type="text"  placeholder=" 客户电话" style="width:180px" class="input-text"id="phone">&nbsp;&nbsp;&nbsp;
        &nbsp;
        <button  id="doSearch" class="btn btn-success radius" ><i class="Hui-iconfont">&#xe665;</i> 搜订单
        </button>

    </div>

    <table id="searchTable" style="margin-top:5px" style="width:1480px">
        <tr style="background-color:#a6c9e2;height:42px">
            <th colspan="10" scope="col" >
                 <span class="l"><a href="javascript:;" onClick="orderAdd()"
                                    class="btn btn-primary radius" ><i class="Hui-iconfont">&#xe600;</i> 下单</a>

        <%--<a href="javascript:;" onClick="delUser()" class="btn btn-danger radius" ><i class="Hui-iconfont">&#xe6e2;</i>  批量删除</a></span>--%>

            </th>
        </tr>
        <tr>
            <th w_num="line" width="3%;"></th>
            <th w_check="true" w_index="uuid" width="3%;"></th>
            <th w_index="uuid" w_sort="uuid" width="12%">编号</th>
            <th w_index="date" width="12%;">时间</th>
            <th w_index="customer" width="12%;">客户</th>
            <th w_index="docname" width="15%">文件名</th>
            <th w_index="money" width="15%">总价</th>
            <th w_index="status" w_render="formatStatus" width="10%">状态</th>
            <th w_render="operate" width="10%;">操作</th>
        </tr>
    </table>
</div>

</body>
</html>
<%@include file="../../head-ui.jsp" %>
<script type="text/javascript">
    var gridObj;

    $(function () {
        gridObj = $.fn.bsgrid.init('searchTable', {
            url: '<%=request.getContextPath()%>/back/order/list.do?status=-1',
            // autoLoad: false,
            pageSizeSelect: true,
            //pagingLittleToolbar: true,
            stripeRows: true,
            pageSize: 20,
            rowHoverColor: true,
            stripeRows: true,
            displayBlankRows: false
        });

        $("#doSearch").click(function () {
            doSearch();
        })
    });
    function doSearch() {
        var searchParames = {'uuid': $("#uuid").val(), customer:encodeURI($("#customer").val()), phone: $("#phone").val(),status:'-1'};
        gridObj.search(searchParames);
    }
    function formatStatus(record, rowIndex, colIndex, options) {
        debugger;
        var result="";
        if( record.status == '0'){
            result="<span class='label label-success radius'>已完成</span>";
        }else if(record.status == '1'){
            result= "<span class='label radius'>已下单</span>";
        }else if(record.status == '2'){
            result= "<span class='label radius'>已确认</span>";
        }else if(record.status == '3'){
            result= "<span class='label radius'>已出货</span>";
        }else if(record.status == '4'){
            result= "<span class='label radius'>已收货</span>";
        }else if(record.status == '5'){
            result= "<span class='label radius'>已付款</span>";
        }else if(record.status == '-1'){
            result= "<span class='label radius'>已取消</span>";
        }
        return result;
    }

    function operate(record, rowIndex, colIndex, options) {
        return "<a title='订单查看' href='javascript:void(0)' " +
                "onClick=\"order_see('" + record.uuid + "','订单查看'," +
                "'<%=request.getContextPath()%>/user/edit_page.do')\" class='ml-5' style='text-decoration:none'><i class='Hui-iconfont'>&#xe6df;</i></a>" ;
    }
    function delUser(){
        var unids = gridObj.getCheckedValues('unid');
        if(unids==null||unids==""){
            layer.msg('请选择需要删除的用户!',{icon: 1,time:1000});
        }else{
            user_del(unids.join(","));
        }
    }
    function role_link(unid){
        layer_show('用户角色关联',$("#contextPath").val()+"/back/user/rolelink_page.do?unid="+unid,'500','510');
    }
    function orderAdd(){
        layer_show('咸蛋',$("#contextPath").val()+"/back/order/add_page.do",'500','500');
    };

</script>
<script type="text/javascript" src="<%=request.getContextPath()%>/resources/js/util.js"></script>